package com.gamatechno.adapter;


import java.util.ArrayList;
import java.util.HashMap;

import com.gamatechno.solodestination.LihatDataActivity;
import com.gamatechno.solodestination.R;


import android.R.integer;
import android.app.Activity;
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class LazyAdapter extends BaseAdapter {

	private Activity activity;
	private ArrayList<HashMap<String, String>> data;
	private static LayoutInflater inflater = null;


	public LazyAdapter(Activity a, ArrayList<HashMap<String, String>> d) {
		activity = a;
		data = d;
		inflater = (LayoutInflater) activity
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		
	}

	public int getCount() {
		return data.size();
	}

	public Object getItem(int position) {
		return position;
	}

	public long getItemId(int position) {
		return position;
	}

	public View getView(int position, View convertView, ViewGroup parent) {
		View vi = convertView;
		if (convertView == null)
			vi = inflater.inflate(R.layout.list_row, null);
		HashMap<String, String> song = new HashMap<String, String>();
		song = data.get(position);
	
		TextView outputan = (TextView) vi.findViewById(R.id.no_senjata);
		
		
		

		// Setting all values in listview
		outputan.setText(song.get(LihatDataActivity.KEY_NAMA));
//		pangkat.setText(song.get(LihatDataActivity.KEY_PANGKAT));
//		id.setText(song.get(LihatDataActivity.KEY_ID));
//		noaic.setText(song.get(LihatDataActivity.KEY_NOAIC));
//		nosenjata.setText(song.get(LihatDataActivity.KEY_NOSEN));
		// status.setText(song.get(LihatDataActivity.KEY_STATUS));
		// imageLoader.DisplayImage(song.get(LihatDataActivity.KEY_THUMB_URL),
		// thumb_image);
		return vi;
	}
}